//
//  giftStroageDataSource.m
//  tcpoctest
//
//  Created by gump on 6/5/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "giftStroageDataSource.h"

@implementation giftStroageDataSource

-(id)init
{
    self = [super init];
    
    if (self != nil) {
        GSShowArr = [[NSMutableArray alloc] init];
        
        pthread_mutex_init(&mutexGS, 0);
    }
    
    return self;
}

-(void)addGiftStroageInfo:(giftStroageDataInfo *)gsinfo
{
    pthread_mutex_lock(&mutexGS);
    
    [GSShowArr addObject:gsinfo];
    
    pthread_mutex_unlock(&mutexGS);
}

-(void)delAllArr
{
    pthread_mutex_lock(&mutexGS);
    
    [GSShowArr removeAllObjects];
    
    pthread_mutex_unlock(&mutexGS);
}

-(NSMutableArray *)GetGSArr
{
    NSMutableArray *showarr = nil;
    
    pthread_mutex_lock(&mutexGS);
    
    showarr = GSShowArr;
    
    pthread_mutex_unlock(&mutexGS);
    
    return showarr;
}

-(int)GetArrCount
{
    int icount = 0;
    
    pthread_mutex_lock(&mutexGS);
    
    icount = GSShowArr.count;
    
    pthread_mutex_unlock(&mutexGS);
    
    return icount;
}

@end
